package com.school.lab.service.impl;

import java.util.List;

import com.school.lab.dao.RoleDao;
import com.school.lab.domain.Role;
import com.school.lab.service.RoleService;

public class RoleServiceImpl implements RoleService {
	
	private RoleDao roleDao;

	public void setRoleDao(RoleDao roleDao) {
		this.roleDao = roleDao;
	}

	/* (non-Javadoc)
	 * @see com.sw.service.RoleService#delRole(java.lang.Long)
	 */
	
	public void delRole(Long roleId) {
		roleDao.delete(roleId);
	}

	/* (non-Javadoc)
	 * @see com.sw.service.RoleService#getRoleById(java.lang.Long)
	 */
	
	public Role getRoleById(Long roleId) {
		return roleDao.get(roleId);
	}

	/* (non-Javadoc)
	 * @see com.sw.service.RoleService#saveRole(com.sw.domain.Role)
	 */
	
	public void saveRole(Role role) {
		roleDao.save(role);
	}

	/* (non-Javadoc)
	 * @see com.sw.service.RoleService#updateRole(java.lang.Long)
	 */
	
	public void updateRole(Role role) {
		roleDao.saveOrUpdate(role);
	}

	
	public List<Role> findRole() {
		return roleDao.loadAll();
	}

	
	public Role getRoleByName(String name) {
		return roleDao.getRoleByName(name);
	}
}
